<?php
/**
 * Created by PhpStorm.
 * User: zhoubinbin
 * Date: 2017/12/13
 * Time: 下午1:28
 */

namespace app\admin\model;


use think\Model;

class MemberModel extends Model
{
    protected $table = 'zh_user';
    public function getMenberData($id){
    	$result = $this->table('zh_user')->where('userId',$id)->find();
    	if(!$result){
    		return false;
    	}
    	return $result;
    }

        /**
     * 编辑文章信息
     * @param $param
     */
    public function editMember($param)
    {
        try{

            $result = $this->allowField(true)->save($param, ['userId' => $param['userId']]);

            if(false === $result){
                // 验证失败 输出错误信息
                return msg(-1, '', $this->getError());
            }else{
                return msg(1, url('member/index'), '编辑成功');
            }
        }catch(\Exception $e){
            return msg(-2, '', $e->getMessage());
        }
    }
}